﻿@model YQBlog.General.GeneralConfigInfo
@using res = Resource.Views.Admin.Admin;
@{YQBlog.General.GeneralConfigInfo ci = ViewBag.CI as YQBlog.General.GeneralConfigInfo;}
@section MenuInfo{
<ul> 
    <li>@Html.ActionLink("-"+ res.ManagementHome+" -", "Index", "Admin")</li>
    <li>@Html.ActionLink("-" + res.ContentManagement + " -", "AdminArticle", "Admin", new { tid = 1 }, null)</li>
    <li class="selected">
        <span class="selected-arrow">&nbsp;</span>
        <a href="###">- @res.Configuration -</a>
        <ul>
            <li  class="selected">@Html.ActionLink(res.BasisSet, "AdminBaseConfig", "Admin")</li>
            <li>@Html.ActionLink(res.CategorySettings, "AdminCategorySort", "Admin")</li>
        </ul>
    </li>
    <li>@Html.ActionLink("-" + res.UserManagement + " -", "AdminUserList", "Admin")</li>
</ul>
}
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> 
<div id="mainContent">
        <div id="leftBox">
          <div id="pagePath">
          @res.Location：@res.BasisSet
          </div>
          <a name="main"></a>
          <div class="contentBox">
            <div class="contentBoxTop">
              <h3>@res.BasisSet</h3>
                <ul class="switcherTabs">
                    <li class=""><a tar="#box-3">-@res.StaticSet-</a></li>
                    <li class=""><a tar="#box-2">-@res.EmailSet-</a></li>
                    <li class="selected"><a tar="#box-1">-@res.BasisSet- </a></li>
                </ul>
            </div>
            <div class="innerContent">
                @using (Ajax.BeginForm("AdminBaseConfig", new AjaxOptions { LoadingElementId = "Loading", InsertionMode = InsertionMode.InsertBefore, OnSuccess = "ProcessSuccess" }))
                {

                    <div id="AjaxResult">
                    <div id="box-1" class="tab1-box" style="display: block;">
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.Webtitle)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.Webtitle, new { style = "width: 500px;" })
                                @Html.ValidationMessageFor(m => m.Webtitle)
                            </div>
            </div>
            <div class="label">
                    <div class="editor-label">
                        @Html.LabelFor(m => m.WebDescription)
                    </div>
                    <div class="editor-field clstxtarea">
                        @Html.TextAreaFor(model => model.WebDescription, new { style = "width: 500px; height:80px" })
                        @Html.ValidationMessageFor(m => m.WebDescription)
                    </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.Weburl)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.Weburl, new { style = "width: 500px;" })
                                @Html.ValidationMessageFor(m => m.Weburl)
                            </div>
            </div>
            <div class="label hide">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.WebPath)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.WebPath, new { style = "width: 200px;" })
                                @Html.ValidationMessageFor(m => m.WebPath)
                            </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.Logo)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.Logo, new { style = "width: 500px;" })
                                @Html.ValidationMessageFor(m => m.Logo)
                            </div>
            </div>
                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.Theme)
                            </div>
                            <div class="editor-field">
                                @Html.DropDownList("Theme")
                            </div>
                        </div>

                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.WebLangList)
                            </div>
                            <div class="editor-field">
                            @foreach (var o in ViewBag.Langs as IEnumerable<YQBlog.Models.MyCheckBox>) {
                                var optionValue = "WebLangList" + o.Value;
                                    <input type="checkbox"          
                                    id="@optionValue"          
                                    name="WebLangList"         
                                    value="@o.Value"
                                    @if (o.IsChecked)
                                    {@Html.Raw("checked=\"checked\"")}/>   
                                                <label for="@optionValue">@o.Text</label>  @:&nbsp;
                            } 
                            <span class="red hide" id="WebLangListTip">@res.Atleastone</span>
                            </div>
                        </div>

                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.DefaultLang)
                            </div>
                            <div class="editor-field">
                                @Html.DropDownList("DefaultLang")
                                <span class="red hide" id="DefaultLangTip">@res.DefaultLangSet</span>
                            </div>
                        </div>

            <div class="label hide">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.Icp)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.Icp, new { style = "width: 200px;" })
                                @Html.ValidationMessageFor(m => m.Icp)
                            </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.IndexPagerCount)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.IndexPagerCount, new { style = "width: 30px;" })
                                @Html.ValidationMessageFor(m => m.IndexPagerCount)
                            </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.CatePagerCount)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.CatePagerCount, new { style = "width: 30px;" })
                                @Html.ValidationMessageFor(m => m.CatePagerCount)
                            </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.CommentPagerCount)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.CommentPagerCount, new { style = "width: 30px;" })
                                @Html.ValidationMessageFor(m => m.CommentPagerCount)
                            </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.NotePagerCount)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.NotePagerCount, new { style = "width: 30px;" })
                                @Html.ValidationMessageFor(m => m.NotePagerCount)
                            </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.ThumbnailInfo)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.ThumbnailInfo, new { style = "width: 200px;" })
                                @Html.ValidationMessageFor(m => m.ThumbnailInfo)
                            </div>
            </div>
            <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(m => m.MaxSummaryCharCount)
                            </div>
                            <div class="editor-field">
                                @Html.TextBoxFor(m => m.MaxSummaryCharCount, new { style = "width: 30px;" })
                                @Html.ValidationMessageFor(m => m.MaxSummaryCharCount)
                            </div>
            </div>

                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(model => model.UserPermission)
                            </div>
                            <div class="editor-field radios">
                                <input type="radio" value="0" name="UserPermission" id="UserPermission_y" @if (Model.UserPermission == 0)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="UserPermission_y">
                                    @res.Anonymous</label>
                                <input type="radio" value="1" name="UserPermission" id="UserPermission_n" @if (Model.UserPermission == 1)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="UserPermission_n">
                                     @res.LoggedUser</label>
                            </div>
                        </div>

                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(model => model.IfValidateCode)
                            </div>
                            <div class="editor-field radios">
                                <input type="radio" value="1" name="IfValidateCode" id="IfValidateCode_y" @if (Model.IfValidateCode == 1)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfValidateCode_y">
                                    YES</label>
                                <input type="radio" value="2" name="IfValidateCode" id="IfValidateCode_n" @if (Model.IfValidateCode == 2)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfValidateCode_n">
                                     NO</label>
                            </div>
                        </div>


             </div>
                    <div style="display:none" id="box-2" class="tab1-box">
                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(model => model.IfSendReplyEmail)
                            </div>
                            <div class="editor-field radios">
                                <input type="radio" value="1" name="IfSendReplyEmail" id="IfSendReplyEmail_y" @if (Model.IfSendReplyEmail == 1)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfSendReplyEmail_y">
                                    YES</label>
                                <input type="radio" value="2" name="IfSendReplyEmail" id="IfSendReplyEmail_n" @if (Model.IfSendReplyEmail == 2)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfSendReplyEmail_n">
                                     NO</label>
                            </div>
                        </div>
                        <div class="label">
                                        <div class="editor-label">
                                            @Html.LabelFor(m => m.SmtpServer)
                                        </div>
                                        <div class="editor-field">
                                            @Html.TextBoxFor(m => m.SmtpServer, new { style = "width: 300px;" })
                                            @Html.ValidationMessageFor(m => m.SmtpServer)
                                        </div>
                        </div>
                        <div class="label">
                                        <div class="editor-label">
                                            @Html.LabelFor(m => m.SmtpPort)
                                        </div>
                                        <div class="editor-field">
                                            @Html.TextBoxFor(m => m.SmtpPort, new { style = "width: 50px;" })
                                            @Html.ValidationMessageFor(m => m.SmtpPort)
                                        </div>
                        </div>
                        <div class="label">
                                        <div class="editor-label">
                                            @Html.LabelFor(m => m.SmtpUser)
                                        </div>
                                        <div class="editor-field">
                                            @Html.TextBoxFor(m => m.SmtpUser, new { style = "width: 300px;" })
                                            @Html.ValidationMessageFor(m => m.SmtpUser)
                                        </div>
                        </div>
                        <div class="label">
                                        <div class="editor-label">
                                            @Html.LabelFor(m => m.AdminEmail)
                                        </div>
                                        <div class="editor-field">
                                            @Html.TextBoxFor(m => m.AdminEmail, new { style = "width: 300px;" })
                                            @Html.ValidationMessageFor(m => m.AdminEmail)
                                        </div>
                        </div>
                        <div class="label">
                                        <div class="editor-label">
                                            @Html.LabelFor(m => m.SmtpPass)
                                        </div>
                                        <div class="editor-field">
                                            @Html.PasswordFor(m => m.SmtpPass, new { style = "width: 300px;", value = Model.SmtpPass })
                                            @Html.ValidationMessageFor(m => m.SmtpPass)
                                        </div>
                        </div>

                    </div>

                    <div style="display:none" id="box-3" class="tab1-box">

                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(model => model.IfWebStatic)
                            </div>
                            <div class="editor-field radios">
                                <input type="radio" value="1" name="IfWebStatic" id="IfWebStatic_y" @if (Model.IfWebStatic == 1)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfWebStatic_y">
                                    YES</label>
                                <input type="radio" value="2" name="IfWebStatic" id="IfWebStatic_n" @if (Model.IfWebStatic == 2)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfWebStatic_n">
                                     NO</label>
                            </div>
                        </div>

                        <div class="label">
                            <div class="editor-label">
                                @Html.LabelFor(model => model.IfHtmlCreated)
                            </div>
                            <div class="editor-field radios">
                                <input type="radio" value="1" name="IfHtmlCreated" id="IfHtmlCreated_y" @if (Model.IfHtmlCreated == 1)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfHtmlCreated_y">
                                    YES</label>
                                <input type="radio" value="2" name="IfHtmlCreated" id="IfHtmlCreated_n" @if (Model.IfHtmlCreated == 2)
                                                                                                    {@Html.Raw("checked=\"checked\"")}/>
                                <label for="IfHtmlCreated_n">
                                     NO</label>
                            </div>
                        </div>
                        <div class="label">
                                        <div class="editor-label">
                                            @Html.LabelFor(m => m.WebStaticFolder)
                                        </div>
                                        <div class="editor-field">
                                            /
                                            @Html.TextBoxFor(m => m.WebStaticFolderPart1, new { style = "width: 50px;" })
                                            /{lang}/
                                            @Html.TextBoxFor(m => m.WebStaticFolderPart2, new { style = "width: 260px;" })
                                            @Html.ValidationMessageFor(m => m.WebStaticFolderPart1)
                                            @Html.ValidationMessageFor(m => m.WebStaticFolderPart2)
                                        </div>
                        </div>


                    </div>
                            <p>
                                <input type="image" src="/Content/image/admin/bt_submit.gif" name="BtnSubmit" id="BtnSubmit"> 
                                <span id="Loading" style="display:none;"> @res.Ajax_Tip</span>
                            </p>
                    </div>
                }
            </div>
          </div>

      </div>
              
  </div>
@section Js{
<script type="text/javascript">

    $(function () {
        $(":checkbox[name=WebLangList]").click(function () {
            $('#WebLangListTip').hide();
            $('#DefaultLangTip').hide();
        });

        $('#DefaultLang').change(function () {
            $('#DefaultLangTip').hide();
        });

    });

    $("#BtnSubmit").click(function () {
        var selectLangs = "";
        $(":checkbox[name=WebLangList]:checked").each(function () {
            selectLangs += $(this).val();
        })
        if (selectLangs == "") {
            $('#WebLangListTip').show();
            $(":checkbox[name=WebLangList]").focus();
            return false;
        }
        if (selectLangs.indexOf($('#DefaultLang').val()) == -1) {
            $('#DefaultLangTip').show();
            $(":checkbox[name=WebLangList]").focus();
            return false;
        }
    });


    function ProcessSuccess(re) {
        $('#AjaxResult').html(re);
    }

    $(".switcherTabs li").click(function () {
        var tar = $(this).find("a").attr("tar");
        $(this).addClass("selected").siblings("li").removeClass("selected");
        $(".tab1-box").hide();
        $(tar).show();
    });
</script> 
}